<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/view/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
		<script src="${contextPath}/scripts/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>
		<script src="${contextPath}/scripts/common.js" type="text/javascript"></script>
		<script src="${contextPath}/scripts/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
</head>
<body>
<div class="navigation">
	    <span>
	    <a href="javascript:window.history.forward();"><img src="${contextPath}/images/go_nav_btn.png" /></a>
	     <a href="javascript:window.history.forward();">前进</a>
	    <a href="javascript:window.location.reload();"><img src="${contextPath}/images/refresh_nav_btn.png" /></a>
	     <a href="javascript:window.location.reload();">刷新</a>
    </span>绩效管理&gt;&gt; 名单管理</div>
    
    <div id="loading" style="display:none;position:absolute;left:0;width:100%;height:800px;top:0;background:#E0ECFF;opacity:0.8;filter:alpha(opacity=80);">
	<div id="loading2" style="position:absolute;  cursor1:wait;left:350px;top:200px;width:auto;height:16px;padding:8px 5px 10px 30px;background:#fff url(/certificate/images/ajax-loading.gif) no-repeat scroll 5px 10px;border:2px solid #ccc;color:#000;">  
		正在生成数据，请耐心等待 . . .   
	</div>
</div>
    
    
<div class="xt_main_right_center">
<form name="form1" id="form1" method="post" action="index.do">
  <table width="100%" border="0" >
    <tr>
      <td class="left-td-width-bg" >姓名:</td>
      <td class="right-td-width-bg-left" > <input class="input" type="text" value="${search.author.realName }" name="search.author.realName" id="textfield"></td>
      <td class="left-td-width-bg" >日期：</td>
      <td class="right-td-width-bg-left">
      <input name="search.deliveryTime"   class="Wdate" type="text" style="width: 100px" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="true" value="<s:date name="search.deliveryTime" format="yyyy-MM-dd"/>"/>
      <td class="left-td-width-bg">状态：</td>
       <td class="right-td-width-bg-left">
       <s:select name="state" list="@com.jysz.certificate.persistence.enums.pm.PmUserStype@values()" theme="simple" listKey="index" listValue="name" headerKey="" headerValue="--请选择--" value="state"></s:select></td>
    </tr>
    <tr style="background:url(${contextPath}/images/xt_main_right_dhbj.jpg) repeat-x;">
      <td colspan="6" align="right">
        <input type="submit" name="button"  class="btn_query" id="button" value="">
        <input type="reset" name="button2" onClick="clearForm(this.form);return false;"   class="btn_clear_form"  id="button2" value="">      </td>
      </tr>
  </table>
  </form>
  </div>
  <table width="100%" border="0">
    <tr>
      <td align="right">&nbsp;</td>
      <td colspan="2" align="right">&nbsp;</td>
    </tr>
    <tr>
      <td align="left"><font color="#0066CC"><strong>查询结果：</strong></font></td>
      <td colspan="2" align="right"><label>
       <jysz:permission code="PM_USER_ADD">
        <a href="javascript:add()"><img src="${contextPath}/images/btn_add.png" alt="新增" /></a></jysz:permission>
      </label></td>
    </tr>
  </table>
  <table  width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC" align="center">
    <tr>
      <td class="top-td-width-bg">序号</td>
      <td class="top-td-width-bg">发布人</td>
      <td class="top-td-width-bg">区域</td>
      <td class="top-td-width-bg">发布月份</td>
      <td class="top-td-width-bg">发布日期</td>
      <td class="top-td-width-bg">数据来源</td>
      <td class="top-td-width-bg">发布状态</td>
      <td class="top-td-width-bg">操作</td>
    </tr>
        <s:iterator value="page.result" status="i" id="b">
    <tr >
      <td class="down-center-td-width-bg">${i.count }</td>
      <td class="down-center-td-width-bg">${b.author.realName }</td>
      <td class="down-center-td-width-bg">${b.area }</td>
      <td class="down-center-td-width-bg">${b.deliceryMM }</td>
      <td class="down-center-td-width-bg"><s:date name="deliveryTime" format="yyyy-MM-dd"/></td>
       <td class="down-center-td-width-bg"><s:if test='#b.mark == false'>自动生成</s:if><s:else>手工添加</s:else></td>
      <td class="down-center-td-width-bg">${b.state.name }</td>
      <td class="down-center-td-width-bg">
       <s:if test="@com.jysz.certificate.persistence.enums.pm.PmUserStype@NOTSTART.equals(state)">
       <jysz:permission code="PM_USER_UPDATE">
      <a href="javascript:update(${b.id })" title="编辑"><img src="${contextPath}/images/edit.gif" alt="编辑" width="16" height="13" border="0" /></a>&nbsp;
      </jysz:permission>
    
      <jysz:permission code="PM_USER_SUBMIT">
      <a href="javascript:openPass('${b.id }','${b.area }')" title="提交人员"><img src="${contextPath}/images/tijiao.jpg" alt="提交人员" width="16" height="13" border="0" /></a>&nbsp;
      </jysz:permission>
        <jysz:permission code="PM_USER_DELETE">
      <a href="javascript:deleteUp(${b.id })" title="删除"><img src="${contextPath}/images/del.gif" alt="删除" width="16" height="13" border="0" /></a></jysz:permission>
      </s:if>
       <a href="javascript:openEdit(${b.id })" title="详细"><img src="${contextPath}/images/chakan.gif" alt="详细" width="16" height="13" border="0" /></a>
      </td>
    </tr>
    </s:iterator>
     <tr>
      <td class="down-center-td-width-bg"  colspan="13" align="right"> <%@ include file="/WEB-INF/view/common/pagination.jsp"%></td>
    </tr>
  </table>
  <p>&nbsp;</p>

<script type="text/javascript">
		function jumpPage(page) {
			var searchForm = document.form1;
			searchForm.action = "<s:property value='contextPath'/>/pm/user/index.do?currentPage=" + page;
			searchForm.submit();
		} 
function add(){
	showLoading();
	var searchForm = document.form1;
	searchForm.action = "openAdd.do";
	searchForm.submit();
}
function openPass(id,area){
	this.doAjaxTest(area);
	if(bo){
		var searchForm = document.form1;
		searchForm.action = "<s:property value='contextPath'/>/pm/user/openPass.do?currentPage=${currentPage}&id="+id;
		searchForm.submit();
	}
	
}
function update(id){
	var searchForm = document.form1;
	searchForm.action = "<s:property value='contextPath'/>/pm/user/edit.do?currentPage=${currentPage}&id="+id;
	searchForm.submit();
}
function deleteUp(id){
	if(confirm("是否删除")){
		var searchForm = document.form1;
		searchForm.action = "<s:property value='contextPath'/>/pm/user/delete.do?currentPage=${currentPage}&id="+id;
		searchForm.submit();
	}
	
}
function openEdit(id){
	var searchForm = document.form1;
	searchForm.action = "<s:property value='contextPath'/>/pm/user/openEdit.do?currentPage=${currentPage}&id="+id;
	searchForm.submit();
}
var bo = true;
function doAjaxTest(area){
	area = encodeURI(area); 
	area = encodeURI(area); 
		$.ajax({
			  async:false,
			  type: 'POST',
			  url:"<s:property value='contextPath'/>/pm/user/ifYouBe.do?msg="+area+"",
			  dataType: "json",
			  success: function(data) {
				  if(data){
					  alert("本月已发布人员名单,或者区域冲突，请重新生成"); 
					  bo = false;
				  }
			  }
			});
	
}

function showLoading(){
	var height = window.screen.height-250;   
	 var width = window.screen.width;   
	 var leftW = 300;   
	 if(width>1200){   
	    leftW = 500;   
	 }else if(width>1000){   
	    leftW = 350;   
	 }else { 
	    leftW = 100;   
	 } 
	 $("#loading").css("height",height);
     $("#loading2").css("left",leftW);
     $("#loading").show();
}
$(document).ready(function () {
	$("#loading").hide();
});
</script>
<br/><br/><br/><br/><br/>
		<div><jsp:include page="/include/footer.inc"></jsp:include></div>
</body>
</html>